home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form lblRGBDemo
- Caption = "RGBDemo"
- ClientHeight = 3780
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5880
- LinkTopic = "Form1"
- ScaleHeight = 252
- ScaleMode = 3 'Pixel
- ScaleWidth = 392
- StartUpPosition = 3 'Windows Default
- Begin VB.HScrollBar hscRGB
- Height = 255
- Index = 2
- Left = 600
- Max = 255
- TabIndex = 6
- Top = 3480
- Width = 2295
- End
- Begin VB.HScrollBar hscRGB
- Height = 255
- Index = 1
- Left = 600
- Max = 255
- TabIndex = 5
- Top = 3120
- Width = 2295
- End
- Begin VB.HScrollBar hscRGB
- Height = 255
- Index = 0
- Left = 600
- Max = 255
- TabIndex = 4
- Top = 2760
- Width = 2295
- End
- Begin VB.PictureBox picColors
- AutoSize = -1 'True
- Height = 2745
- Left = 0
- Picture = "frmMain.frx":0000
- ScaleHeight = 179
- ScaleMode = 3 'Pixel
- ScaleWidth = 382
- TabIndex = 0
- Top = 0
- Width = 5790
- End
- Begin VB.Label lblInfo
- Caption = "Move your mouse over the picture above and see what happens..."
- Height = 735
- Left = 3720
- TabIndex = 10
- Top = 2880
- Width = 1935
- End
- Begin VB.Shape Shape1
- Height = 975
- Left = 3600
- Top = 2760
- Width = 2175
- End
- Begin VB.Label lblRGB
- Alignment = 2 'Center
- BorderStyle = 1 'Fixed Single
- Caption = "0"
- Height = 255
- Index = 2
- Left = 3000
- TabIndex = 9
- Top = 3480
- Width = 540
- End
- Begin VB.Label lblRGB
- Alignment = 2 'Center
- BorderStyle = 1 'Fixed Single
- Caption = "0"
- Height = 255
- Index = 1
- Left = 3000
- TabIndex = 8
- Top = 3120
- Width = 540
- End
- Begin VB.Label lblRGB
- Alignment = 2 'Center
- BorderStyle = 1 'Fixed Single
- Caption = "0"
- Height = 255
- Index = 0
- Left = 3000
- TabIndex = 7
- Top = 2760
- Width = 540
- End
- Begin VB.Label lblRGBDemo
- AutoSize = -1 'True
- Caption = "Blue:"
- Height = 195
- Index = 2
- Left = 0
- TabIndex = 3
- Top = 3480
- Width = 360
- End
- Begin VB.Label lblRGBDemo
- AutoSize = -1 'True
- Caption = "Green:"
- Height = 195
- Index = 1
- Left = 0
- TabIndex = 2
- Top = 3120
- Width = 480
- End
- Begin VB.Label lblRGBDemo
- AutoSize = -1 'True
- Caption = "Red:"
- Height = 195
- Index = 0
- Left = 0
- TabIndex = 1
- Top = 2760
- Width = 345
- End
- Attribute VB_Name = "lblRGBDemo"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- 'Program : RGBDemo
- 'Author : Yvo van Dillen
- 'Info :
- ' Visual basic has the function :
- ' long = RGB(r,g,b)
- ' But how can you translate it back ?
- ' ( RGB(r,g,b) = long )
- ' For any questions or other code
- ' mail to : yvo23@hotmail.com
- Private Sub hscRGB_Change(Index As Integer)
- 'if one of the horizontal scroll-bars
- 'changes then update the value too. (behind the scrollbars)
- lblRGB(Index).Caption = Val(hscRGB(Index).Value)
- End Sub
- Private Sub picColors_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'define variables
- Dim red As Integer
- Dim green As Integer
- Dim blue As Integer
- Dim color As Long
- 'grab the color from the picture (long)
- color = picColors.Point(X, Y)
- 'This is the function that does it...
- 'You must give :
- 'A color ( and 3 RGB variables)
- 'GetRgb stores the red ,green and blue values
- 'in the give variables...
- GetRgb color, red, green, blue
- 'Update the scrollbars
- hscRGB(0).Value = red
- hscRGB(1).Value = green
- hscRGB(2).Value = blue
- End Sub
-